clear
import spss using "raw data-US.sav"

// deleting the preview survey data
drop in 1/10

//identifying nonproflic ids, and deleting them //deleting extra wording on proflic ids to identify duplicates, etc.

replace Q1 = "5dcfcf3b070fdc0d5fd1952c" in 521
drop in 461
drop in 475
drop in 337
drop in 842
drop in 189

rename Q1 id

duplicates list id

/// there are two duplicates which do not have prolific ids, we drop them
drop in 459
drop in 1058
tab Finished
drop if Finished==0
// n=11 observations which started the survey but never continued. 

destring,replace
gen treatment=.
replace treatment=1 if FL_14_DO_Control==1
replace treatment=2 if FL_14_DO_CongressionalCommittee==1
replace treatment=3 if FL_14_DO_PublicConsultation==1
replace treatment=4 if FL_14_DO_CitizensAssembly==1

drop FL_14_DO_Control FL_14_DO_CongressionalCommittee FL_14_DO_PublicConsultation FL_14_DO_CitizensAssembly

tab treatment

// main DV - compliance
//Are you willing to comply with the coronavirus (COVID-19) lockdown measures for as long as it takes?
tab Q34_1
rename Q34_1 compliance
rename Q35 justification
tab justification

// 2nd DV - trust with the decision

tab Q36_1
rename Q36_1 trustwdecision //Do you trust the government with the decision to extend coronavirus (COVID-19) measures? - definitely not, unsure, definitely yes

// 3rd DV - attitudes towrads the measures
tab Q37_1   // Please indicate if you agree or disagree with the following items. Do you think the decision to prolong the lockdown until May 15...needs to take into account the economic damage it is producing. 
rename Q37_1 economicdamage

tab Q37_2   //... is exaggerated and the lockdown should stop. 
rename Q37_2 exagerrated

tab Q37_3 // is needed to control the spread of the disease. 
rename Q37_3 neededmeasure

// the variables capturing the order of the items are dropped

drop Q37_DO_1 Q37_DO_2 Q37_DO_3

****** TRUST IN MINIPUBLICS, POLITICAL TRUST, ETC. 
tab Q17 		// have you heard of CAs? , 1- yes, 2-no
rename Q17 awareness_minipublic

tab Q18
rename Q18 catrust // 0-no trust, 10- complete trust // Do you think general citizens’ assemblies can be trusted to make informed decisions about a range of policy issues? 0 means they cannot be trusted at all, and 10 means they should definitely be trusted.
tab catrust

tab Q19
recode Q19 (1=5 "definitely yes") (2=4 "probably yes")(3=3 "unsure")(4=2 "probably not")(5=1 "definitely not"),gen(caqualified)	//bigger numbers indicate more trust
drop Q19

factor catrust caqualified
alpha catrust caqualified
// alpha is 0.64

// parliament, legal system, police, policians, political parties, experts

// how much do you think you can trust the gov in washington to do what is right?
tab Q9  
tab Q9_4_TEXT
// the subsequent variable captures open endeded responses to 'other' option and it is sizeable. as such i will manually recode them so i could include the majority in the main variable on trust. different versions of almost never and never have been homogenized so i could add them as additional values to the variable for both trust variables (federal and state-level)


replace Q9_4_TEXT = "almost never" in 85
replace Q9_4_TEXT = "almost never" in 136
replace Q9_4_TEXT = "almost never" in 183
replace Q9_4_TEXT = "almost Never" in 526
replace Q9_4_TEXT = "almost never" in 590
replace Q9_4_TEXT = "almost never" in 713
replace Q9_4_TEXT = "almost never" in 732
replace Q9_4_TEXT = "almost never" in 767
replace Q9_4_TEXT = "almost Never" in 879
replace Q9_4_TEXT = "almost never" in 879
replace Q9_4_TEXT = "almost never" in 917
replace Q9_4_TEXT = "almost never" in 929
replace Q9_4_TEXT = "almost never" in 1008
replace Q9_4_TEXT = "almost never" in 115
replace Q9_4_TEXT = "almost never" in 680
replace Q9_4_TEXT = "almost never" in 771
replace Q9_4_TEXT = "almost never" in 977
replace Q9_4_TEXT = "almost never" in 138
replace Q9_4_TEXT = "almost never" in 179
replace Q9_4_TEXT = "almost never" in 582
replace Q9_4_TEXT = "never" in 583
replace Q9_4_TEXT = "almost never" in 623
replace Q9_4_TEXT = "never" in 717
replace Q9_4_TEXT = "never" in 734
replace Q9_4_TEXT = "almost never" in 735
replace Q9_4_TEXT = "almost never" in 746
replace Q9_4_TEXT = "never" in 757
replace Q9_4_TEXT = "almost never" in 760
replace Q9_4_TEXT = "never" in 761
replace Q9_4_TEXT = "never" in 799
replace Q9_4_TEXT = "never" in 837
replace Q9_4_TEXT = "never" in 838
replace Q9_4_TEXT = "never" in 854
replace Q9_4_TEXT = "almost never" in 898
replace Q9_4_TEXT = "never" in 909
replace Q9_4_TEXT = "never" in 943
replace Q9_4_TEXT = "almost never" in 940
replace Q9_4_TEXT = "almost never" in 939
replace Q9_4_TEXT = "never" in 585
replace Q9_4_TEXT = "never" in 1
replace Q9_4_TEXT = "never" in 12
replace Q9_4_TEXT = "never" in 18
replace Q9_4_TEXT = "never" in 37
replace Q9_4_TEXT = "never" in 38
replace Q9_4_TEXT = "almost never" in 50
replace Q9_4_TEXT = "never" in 60
replace Q9_4_TEXT = "almost never" in 68
replace Q9_4_TEXT = "never" in 73
replace Q9_4_TEXT = "never" in 82
replace Q9_4_TEXT = "almost never" in 88
replace Q9_4_TEXT = "never" in 148
replace Q9_4_TEXT = "almost never" in 162
replace Q9_4_TEXT = "never" in 168
replace Q9_4_TEXT = "almost never" in 201
replace Q9_4_TEXT = "never" in 206
replace Q9_4_TEXT = "almost never" in 207
replace Q9_4_TEXT = "almost never" in 216
replace Q9_4_TEXT = "almost never" in 223
replace Q9_4_TEXT = "never" in 251
replace Q9_4_TEXT = "never" in 261
replace Q9_4_TEXT = "never" in 266
replace Q9_4_TEXT = "never" in 269
replace Q9_4_TEXT = "almost never" in 271
replace Q9_4_TEXT = "never" in 294
replace Q9_4_TEXT = "never" in 322
replace Q9_4_TEXT = "almost never" in 338
replace Q9_4_TEXT = "never" in 352
replace Q9_4_TEXT = "almost never" in 359
replace Q9_4_TEXT = "never" in 373
replace Q9_4_TEXT = "almost never" in 374
replace Q9_4_TEXT = "never" in 386
replace Q9_4_TEXT = "almost never" in 407
replace Q9_4_TEXT = "almost never" in 419
replace Q9_4_TEXT = "never" in 430
replace Q9_4_TEXT = "never" in 439
replace Q9_4_TEXT = "almost never" in 443
replace Q9_4_TEXT = "almost never" in 460
replace Q9_4_TEXT = "never" in 472
replace Q9_4_TEXT = "almost never" in 480
replace Q9_4_TEXT = "never" in 488
replace Q9_4_TEXT = "never" in 490
replace Q9_4_TEXT = "never" in 512
replace Q9_4_TEXT = "almost never" in 526
replace Q9_4_TEXT = "almost never" in 615
replace Q9_4_TEXT = "never" in 619
replace Q9_4_TEXT = "never" in 641
replace Q9_4_TEXT = "almost never" in 657
replace Q9_4_TEXT = "almost never" in 660
replace Q9_4_TEXT = "almost never" in 665
replace Q9_4_TEXT = "never" in 666
replace Q9_4_TEXT = "almost never" in 671
replace Q9_4_TEXT = "almost never" in 748
replace Q9_4_TEXT = "almost never" in 764
replace Q9_4_TEXT = "almost never" in 786
replace Q9_4_TEXT = "never" in 828
replace Q9_4_TEXT = "almost never" in 844
replace Q9_4_TEXT = "almost never" in 850
replace Q9_4_TEXT = "never" in 947
replace Q9_4_TEXT = "never" in 972
replace Q9_4_TEXT = "never" in 984
replace Q9_4_TEXT = "never" in 988

fre Q9_4_TEXT

fre Q9
// TO RECODE TO INCLUDE NEVER AND ALMOST NEVER AND ALSO SO THAT GREATER NUMBERS INDICATE GREATER TRUST 
rename Q9 federaltrust
recode federaltrust (3=3)(4=.)(2=4)(1=5)

// 1never, 2almost never, 3only some of the time, 4most of the time, 5just about always

fre federaltrust
replace federaltrust=1 if Q9_4_TEXT=="never"
replace federaltrust=2 if Q9_4_TEXT=="almost never"

fre federaltrust

label define federaltrust  1 "never" 2 "almost never" 3 "only some of the time" 4 "most of the time" 5"just about always"
label values federaltrust federaltrust

fre federaltrust

//// we do the same for the trust at state level

tab Q10 
tab Q10_4_TEXT

replace Q10_4_TEXT = "almost never" in 583
replace Q10_4_TEXT = "almost never" in 771
replace Q10_4_TEXT = "almost never" in 809
replace Q10_4_TEXT = "almost never" in 183
replace Q10_4_TEXT = "almost never" in 590
replace Q10_4_TEXT = "never" in 799
replace Q10_4_TEXT = "never" in 790
replace Q10_4_TEXT = "never" in 861
replace Q10_4_TEXT = "never" in 3
replace Q10_4_TEXT = "never" in 12
replace Q10_4_TEXT = "almost never" in 68
replace Q10_4_TEXT = "almost never" in 163
replace Q10_4_TEXT = "almost never" in 164
replace Q10_4_TEXT = "never" in 168
replace Q10_4_TEXT = "almost never" in 189
replace Q10_4_TEXT = "never" in 251
replace Q10_4_TEXT = "never" in 378
replace Q10_4_TEXT = "never" in 439
replace Q10_4_TEXT = "never" in 488
replace Q10_4_TEXT = "almost never" in 526
replace Q10_4_TEXT = "never" in 579
replace Q10_4_TEXT = "never" in 585
replace Q10_4_TEXT = "almost never" in 657
replace Q10_4_TEXT = "never" in 702
replace Q10_4_TEXT = "almost never" in 735
replace Q10_4_TEXT = "almost never" in 760
replace Q10_4_TEXT = "never" in 757
replace Q10_4_TEXT = "never" in 947


fre Q10
// TO RECODE TO INCLUDE NEVER AND ALMOST NEVER AND ALSO SO THAT GREATER NUMBERS INDICATE GREATER TRUST 
rename Q10 statetrust
recode statetrust (3=3)(4=.)(2=4)(1=5)

// 1never, 2almost never, 3only some of the time, 4most of the time, 5just about always

fre statetrust
replace statetrust=1 if Q10_4_TEXT=="never"
replace statetrust=2 if Q10_4_TEXT=="almost never"

fre statetrust

label define statetrust  1 "never" 2 "almost never" 3 "only some of the time" 4 "most of the time" 5"just about always"
label values statetrust statetrust

fre statetrust

////
rename Q11_3 trust_police
rename Q11_4 trust_politician
rename Q11_5 trust_parties
rename Q11_6 trust_expert

fre trust_police trust_politician

********************************************************************************
***********************ATTITUDES TO AUTHORITY DURING THE CRISIS*****************
********************************************************************************
/// some variables need to be recoded, so that the greater values indicate greater authoritarian attitudes during the crisis.

fre Q8_1 
//In times of crises, like coronavirus (COVID-19),individual freedoms become less important. 
recode Q8_1 (6=7 "strongly agree")(7=6 "agree")(8=5 "somewhat agree")(9=4 "neither agree, nor disagree")(10=3 "somewhat disagree")(11=2 "disagree")(12=1 "strongly disagree"),gen(freedom)
fre Q8_1 freedom

fre Q8_2 
// in times of..., heavy-handed measures must be imposed by the government.
recode Q8_2 (6=7 "strongly agree")(7=6 "agree")(8=5 "somewhat agree")(9=4 "neither agree, nor disagree")(10=3 "somewhat disagree")(11=2 "disagree")(12=1 "strongly disagree"),gen(heavy)
fre Q8_2 heavy


fre Q8_3
// in times of..,governments must act without delay. 
recode Q8_3 (6=7 "strongly agree")(7=6 "agree")(8=5 "somewhat agree")(9=4 "neither agree, nor disagree")(10=3 "somewhat disagree")(11=2 "disagree")(12=1 "strongly disagree"),gen(nodelay)
fre Q8_3 nodelay



*************the below do not need recoding***********

fre Q8_4 
//government should respect individual freedoms as far as possible.
recode Q8_4 (6=1 "strongly agree")(7=2 "agree")(8=3 "somewhat agree")(9=4 "neither agree nor disagree")(10=5 "somewhat disagree")(11=6 "disagree")(12=7 "strongly disagree"),gen(respect)
fre respect
fre Q8_4 

fre Q8_5 
//citizens should be consulted before imposing strict restrictions on freedoms. 
recode Q8_5 (6=1 "strongly agree")(7=2 "agree")(8=3 "somewhat agree")(9=4 "neither agree nor disagree")(10=5 "somewhat disagree")(11=6 "disagree")(12=7 "strongly disagree"),gen(consult)
fre consult
fre Q8_5

drop Q8_1 Q8_2 Q8_3 Q8_4 Q8_5

***
factor freedom heavy nodelay respect consult
alpha freedom heavy nodelay respect consult
// cronbach's alpha is good 0.75

gen strong_index=(freedom+heavy+nodelay+consult+respect)
tab strong_index  

//rescaling it to 0-10 instead
sum strong_index,meanonly 
gen strongovpref=(strong_index-r(min))/(r(max)-r(min))*10
lab var strongovpref stronggovpref
tab strongovpref
sum strongovpref

*****************************************************************
******************* INTERPERSONAL TRUST *************************
*****************************************************************
tab Q12_1 //Generally speaking, would you say that most people can be trusted, or that you can't be too careful in dealing with people? On a score of 0 - 10, how much do you trust other people? 0 means "you can't be too careful" and 10 means "most people can be trusted". 
rename Q12_1 interptrust

tab Q13_1 // how much do you trust people from various groups? your family 
rename Q13_1 family_trust

tab Q13_2 //  how much do you trust people from various groups? your neighbourhood
rename Q13_2 neighb_trust

tab Q13_3 // people you konw personally
rename Q13_3 know_trust

tab Q13_4 
rename Q13_4 stranger_trust

tab Q13_5
rename Q13_5 relig_trust

tab Q13_6
rename Q13_6 nation_trust 


*****************************************************************
******************* THREAT PERCEPTIONS *************************
*****************************************************************
/// How severe do you think novel coronavirus (COVID-19) will be in the UK general population as a whole?
tab Q14  
rename Q14 threat1

////How concerned are you that you might become infected with coronavirus (COVID-19)?
tab Q15  
rename Q15 threat2

tab Q16
rename Q16 threat3

alpha threat1 threat2 threat3 //0.76
gen indexthreat=(threat1+threat2+threat3)
tab indexthreat

sum indexthreat,meanonly 
gen indexthreat_re=(indexthreat-r(min))/(r(max)-r(min))*10
tab indexthreat_re

// partisanship ///Generally speaking, do you think of yourself as a...?
tab Q21  		
rename Q21 partisanUS
tab partisanUS

//Would you call yourself a strong Democrat, or not a very strong Democrat? 
tab Q22
rename Q22 strongdemocrat

tab Q23
rename Q23 strongrepublican

tab Q24
rename Q24 leaning

*

tab Q4
rename Q4 age
tab age
mean age


tab Q3 // 1- female,2-male, 3-other
rename Q3 gender
recode gender (3=.)

tab Q5
//1- did not graduate from high school, 2-high school graduate, 3-some college, but no degree, 4-completed a degree at college level, 5-postgraduate degree 
gen usedu=Q5
lab var usedu "US education"

tab Q6
rename Q6 race

tab Q7			//do you have stay at home or shelter in place measures in place in your state
rename Q7 measures

***

tab Q38 //1-politicians, 2-ca, 3-no information about it, 4-public consulation, 5-dont remember
tab Q38,nolab
recode Q38 (3=1 "Noinformation")(1=2 "PoliticianDeliberation")(4=3 "PublicConsultation")(2=4 "Minipublic")(5=5 "Don'tremember"),gen(manipulation)
tab manipulation
tab treatment

gen manipulationcheck=.
recode manipulationcheck(.=1) if treatment==1&manipulation==1 //control
recode manipulationcheck (.=0) if treatment==1&manipulation!=1

recode manipulationcheck (.=1) if treatment==2&manipulation==2 //politiciandelibreation
recode manipulationcheck(.=0) if treatment==2&manipulation!=2

recode manipulationcheck (.=1) if treatment==3&manipulation==3 //public consultation
recode manipulationcheck (.=0) if treatment==3&manipulation!=3

recode manipulationcheck (.=1) if treatment==4&manipulation==4 //minipublic
recode manipulationcheck (.=0) if treatment==4&manipulation!=4

recode manipulationcheck (.=0) if manipulation==5 //dont remember

tab manipulationcheck if treatment==1 //control				// 50%
tab manipulationcheck if treatment==2 //politiciandel		///75%
tab manipulationcheck if treatment==3 //publiconsultation   ///75%
tab manipulationcheck if treatment==4 //minipublic		/// 88%
tab treatment


tab Q20
rename Q20 ideology_US

order id gender age usedu race measures freedom heavy nodelay respect consult strong_index strongovpref federaltrust statetrust trust_police trust_politician trust_parties trust_expert interptrust family_trust neighb_trust know_trust stranger_trust relig_trust nation_trust threat1 threat2 threat3 indexthreat indexthreat_re awareness_minipublic catrust caqualified ideology_US partisanUS strongdemocrat strongrepublican leaning treatment compliance manipulation manipulationcheck 

drop StartDate EndDate Status IPAddress Progress Duration__in_seconds_ Finished RecordedDate ResponseId RecipientLastName RecipientFirstName RecipientEmail ExternalReference LocationLatitude LocationLongitude DistributionChannel UserLanguage Q2 Q3_3_TEXT Q6_11_TEXT Q8_DO_1 Q8_DO_2 Q8_DO_3 Q8_DO_4 Q8_DO_5 Q9_4_TEXT Q10_4_TEXT Q11_DO_3 Q11_DO_4 Q11_DO_5 Q11_DO_6 Q27_First_Click Q27_Last_Click Q27_Page_Submit Q27_Click_Count Q29_First_Click Q29_Last_Click Q29_Page_Submit Q29_Click_Count Q31_First_Click Q31_Last_Click Q31_Page_Submit Q31_Click_Count Q33_First_Click Q33_Last_Click Q33_Page_Submit Q33_Click_Count Q38 justification trustwdecision economicdamage exagerrated neededmeasure

save "us-data-clean.dta", replace
